/* 输入框开始 */
/* 输入框获取焦点 */
var oWriteIn = document.querySelector('.writeIn');
var oInputBtn = document.querySelector('.input-right');
var oInputBtna = document.querySelector('.input-right>a');

oWriteIn.onfocus = function(){
	oInputBtn.style.background = '#1870C9';
}
/* 鼠标移入效果*/
oInputBtn.onmouseover = function(){
	oInputBtn.style.background = '#1E7DD7';
}

oInputBtn.onmouseout = function(){
	oInputBtn.style.background = '#fff';
}

/* 失去焦点 */
oWriteIn.onblur = function(){
	oInputBtn.style.background = '#fff';
}
/* 输入框结束 */

/* 大图轮播 car-img */
/* 获取小圆点 */
var points_ul = document.querySelector('.points');
var points = points_ul.querySelectorAll('li');
/* 获取图片 */
var car_img = document.querySelector('.car-img');
var carImgs = car_img.querySelectorAll('li');
/* 获取上一张下一张的按钮 */
var oPre = document.querySelector('.pre');
var oNext = document.querySelector('.next');

/* 初始化第一个小圆点 */
points[0].style.width = 20 + 'px';
points[0].style.borderRadius = 10 + 'px';
points[0].style.background = '#1870C9';
/* 默认显示第一张图片 */
carImgs[0].style.display = 'block';

var num = 0;
for (var i = 0; i < points.length; i++) {
	points[i].index = i;
	/* 鼠标移入事件 */
	points[i].onmouseover = function () {
		for (var j = 0; j < points.length; j++) {
			points[j].style.width = 10 + 'px';
			points[j].style.borderRadius = 50+'%';
			points[j].style.background = '#dadada';
			carImgs[j].style.display = 'none';
		}
		points[this.index].style.width = 20 + 'px';
		points[this.index].style.borderRadius = 10 + 'px';
		points[this.index].style.background = '#1870C9';
		carImgs[this.index].style.display = 'block';
		num = this.index;
	}
}

/* 大图轮播 下一张图片 */
//var a = 0;
oNext.onclick = function(){
	clean();
	num++;
	if(num>carImgs.length-1){
		num = 0;
	}
	init();
}

/* 大图轮播 上一张 */
oPre.onclick = function(){
	clean();
	num--;
	if(num<0){
		num = carImgs.length-1;
	}
	init();
}

/* 大图轮播 公共样式 */
/* 清空样式 */
function clean(){
	for(var i = 0; i < carImgs.length; i++){
		carImgs[i].style.display = 'none';
		points[i].style.width = 10 + 'px';
		points[i].style.borderRadius = 50+'%';
		points[i].style.background = '#dadada';
	}
}
/* 初始化样式 */
function init(){
	carImgs[num].style.display = 'block';
	points[num].style.width = 20 + 'px';
	points[num].style.borderRadius = 10 + 'px';
	points[num].style.background = '#1870C9';
}	
/* 大图轮播 公共样式 结束*/
/* 大图轮播结束 */

/* 电影模块 */
/* 标题 */
var movie = document.querySelector('.movie-title-c');
var movie_title = movie.querySelectorAll('li>a');

/* 获取下面div */
var moveCont = document.querySelector('.movie-cont');
var moveCont1 = document.querySelector('.movie-cont1');
var moveCont2 = document.querySelector('.movie-cont2');

var moveList = document.querySelectorAll('.movie>.mod');
/* 默认样式 */
movie_title[0].style.color = '#fc6921';
movie_title[0].style.borderBottom = '3px solid #fc6921';

for(var i = 0; i < movie_title.length; i++){
		movie_title[i].index = i;
	movie_title[i].onmouseover = function(){
		for(var j = 0; j < movie_title.length; j++){
			movie_title[j].style.color = '#333';
			movie_title[j].style.borderBottom = 'none';
			moveList[j].style.display = 'none'; 
		}
		this.style.color = '#fc6921';
		this.style.borderBottom = '3px solid #fc6921';
		moveList[this.index].style.display = 'block';
	}
}

/* mall */

var mall_cont = document.querySelector('.mall-cont');
var mall_ul = mall_cont.querySelectorAll('.mall-cont-up');
var mall_pre = document.querySelector('.mall-pre');
var mall_next = document.querySelector('.mall-next');
mall_ul[1].style.display = 'none';
/* 点击上一张 */
var k = 0;
mall_pre.onclick = function(){
	for(var i = 0; i < mall_ul.length; i++){
		mall_ul[i].style.display = 'none';
	}
	k--;
	if(k<0){
		k = mall_ul.length-1;
	}
	mall_ul[k].style.display = 'block';
}
/* 点击下一张 */
mall_next.onclick = function(){
	for(var i = 0; i < mall_ul.length; i++){
		mall_ul[i].style.display = 'none';
	}
	k++;
	if(k > mall_ul.length-1){
		k = 0;
	}
	mall_ul[k].style.display = 'block';
}

/* 特色榜单 fea */
var fea_title = document.querySelector('.featc-r-title');
var fea_span = fea_title.querySelectorAll('span');
var fea_list = document.querySelectorAll('.featc-right');

fea_span[0].style.color = '#1e7dd7';
fea_span[0].style.fontWeight = 'bold';
fea_span[0].style.borderBottom = '2px solid #1e7dd7';

for(var i = 0; i < fea_span.length; i++){
	fea_span[i].index = i;
	fea_span[i].onmouseover = function (){
		for(var i = 0; i < fea_span.length; i++){
			fea_span[i].style.color = '#333';
			fea_span[i].style.fontWeight = 'normal';
			fea_span[i].style.borderBottom = 'none';
			fea_list[i].style.display = 'none';
		}
		fea_span[this.index].style.color = '#1e7dd7';
		fea_span[this.index].style.fontWeight = 'bold';
		fea_span[this.index].style.borderBottom = '2px solid #1e7dd7';
		fea_list[this.index].style.display = 'block';
	}
}

/* rew */
/* 找到参数 */
var rew_imgs = document.querySelectorAll('.rew_imgs');
var rew_point = document.querySelectorAll('.rew_point>li>a');
/* rev-c-d-r */
var rew_article = document.querySelectorAll('.rev-c-dd');
var rew_talk = document.querySelectorAll('.talk');
var rew_user = document.querySelectorAll('.user');

/* 获取上一张下一张按钮 */
var oRewPre = document.querySelector('.rewPre');
var oRewNext = document.querySelector('.rewNext');
/* 默认样式 */
rew_point[0].style.background = '#fff';
var rewNum = 0;
/* 点击事件 */
for(var i = 0; i < rew_point.length; i++){
	rew_point[i].index = i;
	rew_point[i].onclick = function(){
		for(var i = 0; i < rew_point.length; i++){
			rew_imgs[i].style.display = 'none';
			rew_point[i].style.background = '#eadac5';
			rew_article[i].style.display = 'none';
			rew_talk[i].style.display = 'none';
			rew_user[i].style.display = 'none';
		}
		rew_point[this.index].style.background = '#fff';
		rew_imgs[this.index].style.display = 'block';
		rew_article[this.index].style.display = 'block';
		rew_talk[this.index].style.display = 'block';
		rew_user[this.index].style.display = 'none';
		rewNum = this.index;
	}
}

/* 点击下一张 */
oRewNext.onclick = function(){
	rewClean();
	rewNum++;
	if(rewNum > rew_imgs.length-1){
		rewNum = 0;
	}
	rewInit();
}
/* 点击上一张 */
oRewPre.onclick = function(){
	rewClean();
	rewNum--;
	if(rewNum < 0){
		rewNum = rew_imgs.length-1;
	}
	rewInit();
}

/* 清空样式 */ 
function rewClean(){
	for(var i = 0; i < rew_imgs.length; i++){
		rew_imgs[i].style.display = 'none';
		rew_point[i].style.background = '#eadac5';
		rew_article[i].style.display = 'none';
		rew_talk[i].style.display = 'none';
		rew_user[i].style.display = 'none';
	}
}
/* 初始化样式 */
function rewInit(){
	rew_imgs[rewNum].style.display = 'block';
	rew_point[rewNum].style.background = '#fff';
	rew_article[rewNum].style.display = 'block';
	rew_talk[rewNum].style.display = 'block';
	rew_user[rewNum].style.display = 'block';
}
